home *** CD-ROM | disk | FTP | other *** search
- package com.ibm.xml.parser;
-
- import java.io.ByteArrayInputStream;
- import java.io.CharArrayReader;
- import org.w3c.dom.DOMException;
- import org.w3c.dom.Entity;
- import org.w3c.dom.Node;
-
- public class EntityDecl extends Parent {
- static final long serialVersionUID = 1661279924518265405L;
- String name;
- boolean isParameter = false;
- String value;
- ExternalID externalID;
- String ndata;
- byte[] rawByteStream;
- String encoding;
- char[] rawCharStream;
- boolean parsed = false;
-
- public EntityDecl(String var1, String var2, boolean var3) {
- this.name = var1;
- this.value = var2;
- this.isParameter = var3;
- }
-
- public EntityDecl(String var1, ExternalID var2, boolean var3, String var4) {
- this.name = var1;
- this.externalID = var2;
- this.isParameter = var3;
- this.ndata = var4;
- }
-
- public synchronized Object clone() {
- return this.cloneNode(true);
- }
-
- public synchronized Node cloneNode(boolean var1) {
- ((Child)this).checkFactory();
- Object var2 = null;
- EntityDecl var4;
- if (this.externalID != null) {
- var4 = super.factory.createEntityDecl(this.name, new ExternalID(this.externalID.publicID, this.externalID.systemID), this.isParameter, this.ndata);
- } else {
- var4 = super.factory.createEntityDecl(this.name, this.value, this.isParameter);
- }
-
- ((Child)var4).setFactory(((Child)this).getFactory());
- if (var1) {
- var4.children.ensureCapacity(super.children.getLength());
-
- for(int var3 = 0; var3 < super.children.getLength(); ++var3) {
- ((Parent)var4).appendChild(super.children.item(var3).cloneNode(true));
- }
-
- var4.parsed = this.parsed;
- }
-
- return var4;
- }
-
- public boolean equals(Node var1, boolean var2) {
- if (var1 == null) {
- return false;
- } else if (!(var1 instanceof EntityDecl)) {
- return false;
- } else {
- EntityDecl var3 = (EntityDecl)var1;
- if (!this.name.equals(var3.name)) {
- return false;
- } else if (var3.value == null && this.value == null || var3.value != null && var3.value.equals(this.value)) {
- if (this.externalID != null) {
- if (!this.externalID.equals(var3.externalID)) {
- return false;
- }
-
- if ((var3.externalID.systemID != null || this.externalID.systemID != null) && (var3.externalID.systemID == null || !var3.externalID.systemID.equals(this.externalID.systemID))) {
- return false;
- }
-
- if ((var3.externalID.publicID != null || this.externalID.publicID != null) && (var3.externalID.publicID == null || !var3.externalID.publicID.equals(this.externalID.publicID))) {
- return false;
- }
- } else if (var3.externalID != null) {
- return false;
- }
-
- if (var3.ndata == null && this.ndata == null || var3.ndata != null && var3.ndata.equals(this.ndata)) {
- if (var2 && !var3.children.equals(super.children, var2)) {
- return false;
- } else {
- return true;
- }
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
- }
-
- public short getNodeType() {
- return 6;
- }
-
- public String getNodeName() {
- return this.name;
- }
-
- /** @deprecated */
- public String getName() {
- return this.name;
- }
-
- public boolean isParameter() {
- return this.isParameter;
- }
-
- public String getValue() {
- return this.value;
- }
-
- public String getSystemId() {
- return this.externalID.getSystemLiteral();
- }
-
- public String getPublicId() {
- return this.externalID.getPubidLiteral();
- }
-
- public ExternalID getExternalID() {
- return this.externalID;
- }
-
- public boolean isExternal() {
- return this.externalID != null;
- }
-
- /** @deprecated */
- public String getNDATAType() {
- return this.ndata;
- }
-
- public String getNotationName() {
- return this.ndata;
- }
-
- /** @deprecated */
- public boolean isNDATA() {
- return this.ndata != null;
- }
-
- public void acceptPre(Visitor var1) throws Exception {
- var1.visitEntityDeclPre(this);
- }
-
- public void acceptPost(Visitor var1) throws Exception {
- var1.visitEntityDeclPost(this);
- }
-
- Source getInputStream() {
- return this.rawByteStream != null ? new Source(new ByteArrayInputStream(this.rawByteStream), this.encoding) : new Source(new CharArrayReader(this.rawCharStream));
- }
-
- void setValue(String var1) {
- this.value = var1;
- }
-
- void setParsed(boolean var1) {
- this.parsed = var1;
- }
-
- boolean getParsed() {
- return this.parsed;
- }
-
- protected void checkChildType(Node var1) throws DOMException {
- switch (var1.getNodeType()) {
- case 1:
- case 3:
- case 4:
- case 5:
- case 7:
- case 8:
- case 23:
- return;
- default:
- throw new TXDOMException((short)3, "Specified node type (" + var1.getNodeType() + ") can't be a child of EntityReference.");
- }
- }
-
- protected Entity getEntityImpl() {
- if (this.isParameter()) {
- throw new RuntimeException("XML4J internal error: EntityImpl for parameter entity.");
- } else {
- return new EntityImpl(this);
- }
- }
- }
-